package com.patterns.command;

/**
 * @author fwj
 * @date 2021/4/22 15:32
 **/
public class DeleteCommand extends Command {
    Content c;
    String deleted;

    public DeleteCommand(Content c) {
        this.c = c;
    }

    @Override
    public void doit() {
        c.msg = c.msg.substring(0, 11);
        c.msg = c.msg.substring(11, c.msg.length());
    }

    @Override
    public void undo() {
        c.msg = c.msg + deleted;
    }
}
